package com.lhc.storm.drpc.hadoop;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;

/**
 * RPC Server服务
 */
public class RPCServer {

    public static void main(String[] args) throws IOException {

        Configuration conf = new Configuration();
        RPC.Builder builder = new RPC.Builder(conf);
        //Java builder模式
        RPC.Server server = builder.setProtocol(UserService.class)
                .setInstance(new UserServiceImpl())
                .setBindAddress("localhost")
                .setPort(9999)
                .build();
        server.start();
    }
}
